package com.yangming.common.utils;


import com.yangming.common.base.BackJsonBean;
import com.yangming.common.base.BaseResponseEnum;

/**
 * Ajax请求返回的JSON数据
 * 
 * @author LiangMingHui
 *
 */
public class BackJsonBeanUtil {

	/**
	 * @param status
	 *            1 成功 0 失败
	 * @param desc
	 *            结果描述
	 * @param data
	 *            返回的数据对象
	 * @return
	 */
	public static final BackJsonBean<Object> getBackJsonBean(int status, String desc, Object data) {
		BackJsonBean<Object> bean = new BackJsonBean<Object>();
		bean.setStatus(status);
		bean.setDesc(desc);
		bean.setData(data);
		return bean;
	}

	public static final BackJsonBean<Object> getBackJsonBean(BaseResponseEnum responseEnum,Object data) {
		BackJsonBean<Object> bean = new BackJsonBean<Object>();
		bean.setStatus(responseEnum.getStatus());
		bean.setDesc(responseEnum.getDesc());
		bean.setData(data);
		return bean;
	}
}
